package com.stellar.oss.controller;


import com.stellar.oss.service.StorageService;
import com.stellar.web.core.bean.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @Author Jqcc
 * @Version 1.0
 * @Data 2025/3/14
 */
@RestController
@RequestMapping("/api-admin/file")
public class FileUploadController {

    @Resource
    private StorageService storageService;

    @PostMapping("/upload")
    public Result<String> upload(@RequestParam("file") MultipartFile file) {
        String filePath = storageService.uploadFile(file);
        return Result.success(filePath);
    }

}
